﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/AdminMaster2.master" AutoEventWireup="true" CodeFile="my_cmember_list.aspx.cs" Inherits="my_cmember_list" %>

<%@ Import Namespace="System.Data.SqlTypes" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
     
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="apply">
  <div class="apply2">
<%--   <uc_left_m:left_menu ID="left_m1" runat="server" />--%>
    <div class="myul_r">
      <div class="mod_pad4">
<div class="hd_admin"><em class="ulimg_admin">用户列表</em></div>            
        <div class="admin_tab_box1">
          <div class="clear"></div>
       <div class="coupons">
            <table class="w top20" width="1000" border="0" cellspacing="0" cellpadding="0">
              <tr class="t">
              <td width="250" class="c">用户编号</td> 
                <td width="250" class="c">用户名</td>
                <td width="250" class="c">会员等级</td>
                <td width="250" class="c">真实姓名</td> 
                <td width="210" class="c">操作</td>
                <td width="250" class="c">更新账户</td>
                <td width="210" class="c">修改会员等级</td>
              </tr>            
              <%if (list != null && list.Count > 0)
                { %>
                <%for (int k = 0; k < list.Count; k++)
                  { %>
              <tr >
                <td class="cent_align"><%=list[k].Id%></td> 
                <td class="cent_align"><%=list[k].nickname%></td>
                <td class="cent_align"><%=getMemshipTitle(list[k].userLevel)%></td>
                 <td class="cent_align"><%=list[k].realname%></td> 
                <td> 
                <a href="my_cmember_listzj.aspx?t=edit&eid=<%=list[k].Id%>" >查看账户</a> 
                </td>
                  <td>
                  <input type="text" id="moeny<%=list[k].Id%>" name="moeny<%=list[k].Id%>"/>
                <a href="javascript:updateUserMoney(<%=list[k].Id%>);">充值</a>
                </td>
                  <td> 
                  <select id="userLevel<%=list[k].Id%>" name="userLevel<%=list[k].Id%>" >     
              <%if (meblist != null && meblist.Count > 0)
                { %>
                <%for (int a = 0; a < meblist.Count; a++)
                  { %>
                      <option value="<%=meblist[a].ID %>" <%if(list[k].userLevel==meblist[a].ID){%>selected="selected"<%} %>><%=meblist[a].Title%></option> 
                      <%}
                } %>
                  </select>
                <a href="javascript:updateUserLevel(<%=list[k].Id%>);">更改</a>
                </td>
              </tr>
              <%} %>
              <%}
                else
                { %>
             <tr>
                <td colspan='8'><div class='no_data'>^_^&nbsp;&nbsp;没有符合条件的数据！</div></td>
              </tr> 
              <%} %>             
            </table>
          </div>
          <div class="clear"></div>
        </div>
        <div style="text-align:center"> 
                <webdiyer:aspnetpager SubmitButtonClass="buttons"  ID="AspNetPager1" 
                    runat="server" AlwaysShow="True" FirstPageText="首页"
                        NextPageText="下一页" PrevPageText="前一页" LastPageText="尾页" PageSize="10"  
                        OnPageChanged="AspNetPager1_PageChanged">
                    </webdiyer:aspnetpager> </div>
      </div>
    </div>
    <div class="clear"></div>
  </div>
  <div class="clear"></div>
</div>
<script language="javascript" type="text/javascript">
    function updateUserMoney(id) {
      
       

        if (confirm("您确定给该用户充值吗？")) {
            var moeny = document.getElementById("moeny" + id).value;
            var m = moeny;
            if (m <0 ) {
                alert("请填写正整数！");

            } else {
                jQuery.ajax({

                    url: "/Ajax/Otsql.ashx",
                    data: { t: 'updateUserMoney', UserMoney: moeny, utxid: id },
                    type: "POST",
                    success: function (data) {
                        if (data + '' == 'True' || data + '' == 'true') {
                            alert("充值成功!");
                            window.location.reload();
                        } else {
                            alert('充值失败!');
                        }
                    }
                });
            }
            }
           
        }
        function updateUserLevel(id) {
            if (confirm("您确定给该用户等级吗？")) {
                var userLevel = document.getElementById("userLevel" + id).value; 
                jQuery.ajax({
                    url: "/Ajax/Otsql.ashx",
                    data: { t: 'updateUserLevel', utxid: id, UserLevel: userLevel },
                    type: "POST",
                    success: function (data) {
                        if (data + '' == 'True' || data + '' == 'true') {
                            alert("会员等级更改成功!");
                            window.location.reload();
                        } else {
                            alert('会员等级更改失败!');
                        }
                    }
                });
            } 
    }   
</script>
</asp:Content>